Fix Bug: could not convert string to float

Brightcells 6 gadi atpakaļ
vecāks
revīzija
a48abfdb66
2 mainītis faili ar 6 papildinājumiem un 6 dzēšanām
  1. 3 3
      group/group_views.py
  2. 3 3
      group/lensman_views.py

+ 3 - 3
group/group_views.py

@@ -267,9 +267,9 @@ def flyimg_upload_api(request):
267 267
 
268 268
     current_id = int(request.POST.get('current_id', -1))
269 269
 
270
-    longitude = request.POST.get('lon', '')  # 经度
271
-    latitude = request.POST.get('lat', '')  # 纬度
272
-    location = request.POST.get('loc', '')  # 位置
270
+    longitude = float(request.POST.get('lon', 0))  # 经度
271
+    latitude = float(request.POST.get('lat', 0))  # 纬度
272
+    location = float(request.POST.get('loc', 0))  # 位置
273 273
 
274 274
     # 用户校验
275 275
     try:

+ 3 - 3
group/lensman_views.py

@@ -145,9 +145,9 @@ def lensman_photo_upload_api(request):
145 145
 
146 146
     photo = request.FILES.get('photo', '')
147 147
 
148
-    longitude = request.POST.get('lon', '')  # 经度
149
-    latitude = request.POST.get('lat', '')  # 纬度
150
-    location = request.POST.get('loc', '')  # 位置
148
+    longitude = float(request.POST.get('lon', 0))  # 经度
149
+    latitude = float(request.POST.get('lat', 0))  # 纬度
150
+    location = float(request.POST.get('loc', 0))  # 位置
151 151
 
152 152
     # 用户校验
153 153
     try: